package com.blt.car.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.blt.car.home.CarDetailActivity;
import com.blt.car.home.CarListActivity;
import com.blt.car.home.H5Activity;
import com.blt.car.home.MapActivity;
import com.blt.car.home.MessageActivity;
import com.blt.car.home.chosecity.ChooseCityActivity;
import com.blt.car.me.ApplyBillActivity;
import com.blt.car.me.BillDetailActivity;
import com.blt.car.me.BillManagerActivity;
import com.blt.car.me.ChargeActivity;
import com.blt.car.me.ChooseTripsActivity;
import com.blt.car.me.ComplaintDetailActivity;
import com.blt.car.me.ModifyNickActivity;
import com.blt.car.me.MyComplainActivity;
import com.blt.car.me.MyPurseActivity;
import com.blt.car.me.SettingActivity;

import java.util.ArrayList;
import java.util.List;

import blt.app_core.api.journey.bean.AppealInfo;

/**
 * Created by xgp on 2017/6/16.
 */

public class ActivityHelper {


    public static void toChoseCityActivity(Context context, String city) {
        Intent intent = new Intent(context, ChooseCityActivity.class);
        intent.putExtra(ChooseCityActivity.CUR_CITY, city);
        context.startActivity(intent);
    }


    public static void toMessageActivity(Context context) {
        Intent intent = new Intent(context, MessageActivity.class);
        context.startActivity(intent);
    }

    public static void toCarListActivity(Context context) {
        Intent intent = new Intent(context, CarListActivity.class);
        context.startActivity(intent);
    }

    public static void toBannerDetail(Context activity, int id) {
        Intent intent = new Intent(activity, H5Activity.class);
        String url = "http://47.92.113.41/h5/bannerDetail?bannerId=" + id;
        intent.putExtra(H5Activity.HT_URL, url);
        activity.startActivity(intent);
    }

    public static void toSettingActivity(FragmentActivity activity) {
        Intent it = new Intent(activity, SettingActivity.class);
        activity.startActivity(it);
    }

    public static void toMyPurse(FragmentActivity activity) {
        Intent it = new Intent(activity, MyPurseActivity.class);
        activity.startActivity(it);
    }

    public static void toMyComplain(FragmentActivity activity) {
        Intent it = new Intent(activity, MyComplainActivity.class);
        activity.startActivity(it);
    }

    public static void toBillManager(FragmentActivity activity) {
        Intent it = new Intent(activity, BillManagerActivity.class);
        activity.startActivity(it);
    }

    public static void toBillDetail(FragmentActivity activity) {
        Intent it = new Intent(activity, BillDetailActivity.class);
        activity.startActivity(it);
    }

    public static void toChooseTrips(FragmentActivity activity) {
        Intent it = new Intent(activity, ChooseTripsActivity.class);
        activity.startActivity(it);
    }

    public static void toApplyBill(FragmentActivity activity, ArrayList<Integer> ids, int invoiceAmount) {
        Intent it = new Intent(activity, ApplyBillActivity.class);
        Bundle bundle = new Bundle();
        bundle.putIntegerArrayList(ApplyBillActivity.TRAVEL_LIST, ids);
        bundle.putInt(ApplyBillActivity.INVOICE_AMOUNT, invoiceAmount);
        it.putExtra(ApplyBillActivity.TRAVEL_ID, bundle);
        activity.startActivity(it);
    }

    public static void toCarDetailActivity(Context context) {
        Intent carInfo = new Intent(context, CarDetailActivity.class);
        context.startActivity(carInfo);

    }

    public static void toModifyActivity(Activity activity) {
        Intent nick = new Intent(activity, ModifyNickActivity.class);
        activity.startActivityForResult(nick, ModifyNickActivity.MODIFY_NICKNAME_SUCCESS);
    }

    public static void toMapActivity(Activity activity, String city) {
        Intent map = new Intent(activity, MapActivity.class);
        map.putExtra(MapActivity.CITY_NAME, city);
        activity.startActivity(map);
    }

    public static void toComplaintDetail(Context context, AppealInfo appealInfo) {
        Intent intent = new Intent(context, ComplaintDetailActivity.class);
        intent.putExtra("appealId", appealInfo);
        context.startActivity(intent);
    }

    public static void toChargeActivity(Activity myPurseActivity, long balance) {
        Intent intent = new Intent(myPurseActivity, ChargeActivity.class);
        intent.putExtra(ChargeActivity.CHARGE_AMOUNT, balance);
        myPurseActivity.startActivityForResult(intent, 9);

    }
}

